package com.xaioran.springMQ.SpringToPIC;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.stereotype.Service;

@Service
public class SpringMQ_ConsumerT {
    @Autowired
    private JmsTemplate jmsTemplate;
    public static void main(String args[]){
        ApplicationContext applicationContext=new ClassPathXmlApplicationContext("applicatTOPIC.xml");
        SpringMQ_ConsumerT springMQ_consumer=applicationContext.getBean(SpringMQ_ConsumerT.class);
        String retval=(String) springMQ_consumer.jmsTemplate.receiveAndConvert();
        System.out.println("***********消费者收到的消息"+retval);
    }
}
